package com.youmingxing.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;

import com.youmingxing.R;
import com.youmingxing.view.RotateLoading;


/**
 * 请在此处简要描述此类所实现的功能。因为这项注释主要是为了在IDE环境中生成tip帮助，务必简明扼要
 * <p/>
 * 请在此处详细描述类的功能、调用方法、注意事项、以及与其它类的关系.
 */
public class LodingDialog extends Dialog {
    private static RotateLoading rotateLoading;

    private LodingDialog(Context context) {
        super(context);
    }

    private LodingDialog(Context context, int theme) {
        super(context, theme);
    }

    public static LodingDialog createDialog(Context context) {
        LodingDialog customProgressDialog = new LodingDialog(context, R.style.dialog);
        customProgressDialog.setContentView(R.layout.dialog_loding);
        customProgressDialog.getWindow().getAttributes().gravity = Gravity.CENTER;
        rotateLoading = (RotateLoading) customProgressDialog.findViewById(R.id.rotateloading);
        return customProgressDialog;
    }


    @Override
    public void show() {
        super.show();
        if (rotateLoading.isStart()) {
        } else {
            rotateLoading.start();
        }

    }

    @Override
    public void dismiss(){
        if (rotateLoading.isStart()) {
            rotateLoading.stop();
        } else {
        }

        super.dismiss();
    }

}
